# coding: UTF-8
# ----------
# Project_Name : pythonProject
# File_Name : huangcongbing
# Author : asus
# Date_Time:2022/4/27 11:01
# Description :
# ----------
import unittest  # 导入测试框架

from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait  # 导入显式等待类
from selenium.webdriver.support import expected_conditions  # 导入等待条件
from selenium.webdriver.common.action_chains import ActionChains

class zhyzptest(unittest.TestCase):  #必须继承Tescase
    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.wait = WebDriverWait(self.driver,30)
        self.driver.maximize_window()
        self.driver.get("http://192.168.2.6/cloud/#/my")

    def test(self):
        #登录
        self.wait.until(expected_conditions.visibility_of_element_located((By.XPATH,'//*[@id="account"]/input')))
        self.driver.find_element(By.XPATH,'//*[@id="account"]/input').send_keys("admin")
        self.driver.find_element(By.XPATH,'//*[@id="password"]/input').send_keys("123456")
        self.driver.find_element(By.XPATH,'//*[@id="authCode"]/div/input').send_keys("8888")
        self.driver.find_element(By.XPATH,'//*[@id="root"]/div/div[1]/form/div[5]/div/div').click()
        #人员管理
        self.wait.until(expected_conditions.visibility_of_element_located(
            (By.XPATH, '//*[@id="root"]/section/aside/div/ul/li[3]')))
        self.driver.find_element(By.XPATH, '//*[@id="root"]/section/aside/div/ul/li[3]').click()  # 点击人员管理
        # time.sleep(5)#调试时间

        self.wait.until(expected_conditions.visibility_of_element_located((By.XPATH, '//*[@id="system$Menu"]/li')))
        self.driver.find_element(By.XPATH, '//*[@id="system$Menu"]/li').click()  # 点击人员列表

        self.driver.find_element(By.XPATH,'//*[@id="root"]/section/section/main/div/div[1]/button[1]').click()#点击查询
        self.driver.find_element(By.ID,'s_name').send_keys('王飞')#输入姓名查询
        time.sleep(3)
        self.driver.find_elements(By.CLASS_NAME,'ant-btn')[5].click()
        time.sleep(5)





    def tearDown(self) -> None:
        self.driver.quit()